﻿@using System.Globalization
@model PagedList.IPagedList<DoAnWebsite.Models.Ask>
           
@foreach (var item in Model)
{
        <div class="bv-Group left clearfix">
            <div style="margin-bottom: 10px;">@Html.ActionLink(item.Title, "Question", "Home", new { id = item.AskId }, null)</div>
            <div>@Html.Raw(@item.Content)</div>     
        </div>
}
<script>
    $(document).ready(function () {
        var page = @ViewBag.pageNumber;
            var id = "cmpage" + page;
            $(".pagingbar a").removeClass("active");
            $('#' + id).addClass('cmpageActive');
        });
    </script>
    
    @if (Model.PageCount > 1)
    {
        <div class="pagingbar">
            @Ajax.ActionLink("Đầu", "ListQuestionPartial", new {page = 1}, new AjaxOptions {UpdateTargetId = "listquestion"})
            @Ajax.ActionLink("<", "ListQuestionPartial", new {page = Model.PageNumber - 1}, new AjaxOptions {UpdateTargetId = "listquestion"})
            @for (int i = 1; i <= Model.PageCount; i++)
            {
                var page = i.ToString(CultureInfo.InvariantCulture);
                @Ajax.ActionLink(page, "ListQuestionPartial", new {page = i}, new AjaxOptions {UpdateTargetId = "listquestion"}, new {@id = "cmpage" + page})
            }
            @Ajax.ActionLink(">", "ListQuestionPartial", new {page = Model.PageNumber + 1}, new AjaxOptions {UpdateTargetId = "listquestion"})
            @Ajax.ActionLink("Cuối", "ListQuestionPartial", new {page = Model.PageCount}, new AjaxOptions {UpdateTargetId = "listquestion"})
        </div>
    }
